﻿Public Class UIPanel : Inherits UIElement

	Public WithEvents Children As New UIElementList(Me)

	Public Overrides Sub Draw(e As System.Windows.Forms.PaintEventArgs)
		If Not Visible Then Return
		MyBase.Draw(e)
		For Each Child In Children
			Child.Draw(e)
		Next
	End Sub

	Public Overrides Sub Measure()
		For Each Child In Children
			Child.Measure()
		Next
	End Sub

	Public Overrides Sub CheckMouseEvent(e As System.Windows.Forms.MouseEventArgs, Type As String)
		MyBase.CheckMouseEvent(e, Type)
		If Not Visible Then Return
		For Each Child In Children
			Child.CheckMouseEvent(e, Type)
		Next
	End Sub

End Class

Public Class UIElementList : Inherits List(Of UIElement)

	Dim Parent As UIElement

	Sub New(Parent As UIElement)
		Me.Parent = Parent
	End Sub

	Shadows Sub Add(e As UIElement)
		MyBase.Add(e)
		Parent.Initialize(e)
	End Sub

End Class